import router from './router'

const whiteList = ['/login','/index']
router.beforeEach((to, from, next) => {
  let info = JSON.parse(localStorage.getItem("userinfo")) 
  if (info) {
    /* has token*/
    if (to.path === '/login') {
      next({ path: '/' })
    } else {
       next()
    }
  }
})

router.afterEach(() => {
  NProgress.done()
})
